﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using OcelotWebApi01.Filter;

namespace OcelotWebApi01.Controllers
{
    [ApiController]
    [Route("[controller]/Post/[action]")]
    public class ApiController : ControllerBase
    {
        private IHttpContextAccessor _accessor;
        public ApiController(IHttpContextAccessor accessor)
        {
            _accessor = accessor;
        }
        [HttpGet]
        public ActionResult<string> Get01()
        {
            var context = _accessor.HttpContext;
            var hasHead = context.Request.Headers.ContainsKey("MyHead");
            var TempMyHead = context.Request.Headers.ContainsKey("TempMyHead");
            var heads = context.Request.Headers["MyHead"].FirstOrDefault();
            var rng = new Random();
            return "API Get0111Test";
        }
        [HttpGet]
        public ActionResult<string> Get02()
        {
            var rng = new Random();
            return "API Get0222Test";
        }
    }
}
